package com.yuw.jubuinnerclass;

public class Student {
    // 属性 -- 成员变量
    private static String stuName;
    private String stuNum;
    private Integer stuAge;



    // 行为

    public Student() {
    }

    public Student(String stuName, String stuNum, Integer stuAge) {
        this.stuName = stuName;
        this.stuNum = stuNum;
        this.stuAge = stuAge;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    public Integer getStuAge() {
        return stuAge;
    }

    public void setStuAge(Integer stuAge) {
        this.stuAge = stuAge;
    }

    public void doStuding() {
        // 局部变量
        String  schoolName = "tjise";

        /*
        如果局部内部类访问了外部的局部变量，则该局部变量需要为final类型或者是等效【不能修改值】；
            jdk 1.8- 之前要求必须显式写出 final 修饰符；jdk1.8以后可以不用写，但是不能改变这个被访问的局部变量的值；
         */
        // 修改学校名字
        //schoolName = "tjup";
        // 局部内部类
        class StuFamily {
            // 属性
            private String struMotherName;
            private String stuFatherName;
            private String stuFamilyPhone;
            // 行为

            public StuFamily() {
            }

            public StuFamily(String struMotherName, String stuFatherName, String stuFamilyPhone) {
                this.struMotherName = struMotherName;
                this.stuFatherName = stuFatherName;
                this.stuFamilyPhone = stuFamilyPhone;
            }

            public String getStruMotherName() {
                return struMotherName;
            }

            public void setStruMotherName(String struMotherName) {
                this.struMotherName = struMotherName;
            }

            public String getStuFatherName() {
                return stuFatherName;
            }

            public void setStuFatherName(String stuFatherName) {
                this.stuFatherName = stuFatherName;
            }

            public String getStuFamilyPhone() {
                return stuFamilyPhone;
            }

            public void setStuFamilyPhone(String stuFamilyPhone) {
                this.stuFamilyPhone = stuFamilyPhone;
            }

            public void printFamilyInfo() {
                System.out.println("学生学校名字：" + schoolName); // 静态的内部类只能访问静态的对象
                System.out.println("学生家庭信息");
            }
        }

        // 局部变量的作用域范围，可以使用局部内部类
        StuFamily stuFamily = new StuFamily();
        stuFamily.printFamilyInfo();

        System.out.println(this.stuName + " is studing...");
    }
}
